package com.xiaocao.struts;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport{

	public WebApplicationContext getWebApplicationContext() {
		return WebApplicationContextUtils.getWebApplicationContext(getServletContext(ActionContext.getContext()));
	}

	private ServletContext getServletContext(ActionContext context) {

		return ServletActionContext.getServletContext();

	}
}
